package com.accp.service.impl;

import java.util.Date;

import org.springframework.stereotype.Service;

import com.accp.entity.TzSysUser;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

// 这个类没用 暂时没用到
@Service
public class TokenService {
	public String getToken(TzSysUser TzSysUser) {
        Date start = new Date();
        long currentTime = System.currentTimeMillis() + 60* 60 * 1000;//一小时有效时间
        Date end = new Date(currentTime);
        String token = "";
        token = JWT.create().withAudience(TzSysUser.getUserId().toString()).withIssuedAt(start).withExpiresAt(end)
                .sign(Algorithm.HMAC256(TzSysUser.getPassword()));
        return token;
    }
}
